package taobao;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@FieldTypeAnnotation(tableName = "t_u_taobao_data")
public class UserTaoBaoData extends DataObject {
    @FieldTypeAnnotation(select = true,update = true)
    private int activityId;
    @FieldTypeAnnotation(select = true, update = true)
    private long userId;
    @FieldTypeAnnotation(desc = "物品id")
    private int itemId;
    @FieldTypeAnnotation(desc = "初始价格")
    private int initPrice;
    @FieldTypeAnnotation(desc = "可选标签")
    private List<TaoBaoLabel> labelList = new ArrayList<>();
    @FieldTypeAnnotation(desc = "已选标签")
    private List<Integer> selectedLabelList = new ArrayList<>();
    @FieldTypeAnnotation(desc = "涨跌")
    private List<Integer> priceFluctuationList = new ArrayList<>();
    @FieldTypeAnnotation
    private long resetTime;
    @FieldTypeAnnotation
    private int dealStatus;
    @FieldTypeAnnotation
    private int playStatus;
    @FieldTypeAnnotation
    private String priceStatus = "";
    @FieldTypeAnnotation
    private int earnPrice;
    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if (!Objects.equals(this.activityId, activityId)) {
            this.activityId = activityId;
            setUpdateOption();
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (!Objects.equals(this.userId, userId)) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public int getItemId() {
        return itemId;
    }

    public void setItemId(int itemId) {
        if (!Objects.equals(this.itemId, itemId)) {
            this.itemId = itemId;
            setUpdateOption();
        }
    }

    public int getInitPrice() {
        return initPrice;
    }

    public void setInitPrice(int initPrice) {
        if (!Objects.equals(this.initPrice, initPrice)) {
            this.initPrice = initPrice;
            setUpdateOption();
        }
    }

    public List<TaoBaoLabel> getLabelList() {
        return labelList;
    }

    public void setLabelList(List<TaoBaoLabel> labelList) {
        if (!Objects.equals(this.labelList, labelList)) {
            this.labelList = labelList;
            setUpdateOption();
        }
    }

    public List<Integer> getSelectedLabelList() {
        return selectedLabelList;
    }

    public void setSelectedLabelList(List<Integer> selectedLabelList) {
        if (!Objects.equals(this.selectedLabelList, selectedLabelList)) {
            this.selectedLabelList = selectedLabelList;
            setUpdateOption();
        }
    }

    public List<Integer> getPriceFluctuationList() {
        return priceFluctuationList;
    }

    public void setPriceFluctuationList(List<Integer> priceFluctuationList) {
        if (!Objects.equals(this.priceFluctuationList, priceFluctuationList)) {
            this.priceFluctuationList = priceFluctuationList;
            setUpdateOption();
        }
    }

    public void addBargain(int labelIndex, int priceFluctuation) {
        selectedLabelList.add(labelIndex);
        priceFluctuationList.add(priceFluctuation);
        setUpdateOption();
    }

    public long getResetTime() {
        return resetTime;
    }

    public void setResetTime(long resetTime) {
        if (!Objects.equals(this.resetTime, resetTime)) {
            this.resetTime = resetTime;
            setUpdateOption();
        }
    }

    public int getDealStatus() {
        return dealStatus;
    }

    public void setDealStatus(int status) {
        if (!Objects.equals(this.dealStatus, status)) {
            this.dealStatus = status;
            setUpdateOption();
        }
    }

    public int getPlayStatus() {
        return playStatus;
    }

    public void setPlayStatus(int playStatus) {
        if (!Objects.equals(this.playStatus, playStatus)) {
            this.playStatus = playStatus;
            setUpdateOption();
        }
    }

    public String getPriceStatus() {
        return priceStatus;
    }

    public void setPriceStatus(String priceStatus) {
        if (!Objects.equals(this.priceStatus, priceStatus)) {
            this.priceStatus = priceStatus;
            setUpdateOption();
        }
    }

    public int getEarnPrice() {
        return earnPrice;
    }

    public void setEarnPrice(int earnPrice) {
        if (!Objects.equals(this.earnPrice, earnPrice)) {
            this.earnPrice = earnPrice;
            setUpdateOption();
        }
    }

    public int getTotalFluctuation() {
        int fluctuation = 0;
        for (Integer value : priceFluctuationList) {
            fluctuation += value;
        }
        return fluctuation;
    }
}
